//
//  ILEAGLView.h
//  MiHome
//
//  Created by marteswang on 15/2/25.
//  Copyright (c) 2015年 小米移动软件. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ILVideoFrame.h"
#import "ILRendererConstants.h"
#import "ILRenderProtocol.h"

typedef enum
{
    ILEAGLRendererTypeRawYUV420,
    ILEAGLRendererTypeMiJia,
} ILEAGLRendererType;

@class ILVideoFrame;
@protocol ILEAGLRenderer<NSObject>

//- (void)renderBuffer:(void *)buffer;
- (void)renderSize:(CGSize)size;

- (void)renderBuffer:(ILVideoFrame*)frame;
- (void)renderBuffer:(ILVideoFrame*)frame finished:(void (^)())finished;
- (void)flush;
//- (void)renderFrame:(ILVideoFrame*)buffer;
- (BOOL)resizeFromLayer:(CAEAGLLayer*)layer;

- (void)setDataSize:(GLint)newWidth andHeight:(GLint)newHeight;

- (void)enterForeground:(CAEAGLLayer *)layer;

- (void)enterBackground;

- (void)didEnterBackground;
- (void)disableLensCorrent;
- (void)enableLensCorrent;
//设置水平2分屏
-(void)renderSplitHorizontalView:(RenderSplitMode)splitMode;

- (void)disableTimeStampCorrent;
- (void)enableTimeStampCorrent;

- (UIImage*)snapshotPicture;

- (BOOL)lensCorrentStatus;
- (BOOL)timStampCorrentStatus;

- (void)setWaterMarkOffsetX:(CGFloat)x;
- (void)setWaterMarkOffsetY:(CGFloat)y;
- (void)setCorrectionRadius:(CGFloat)radius;
@end


@interface ILEAGLView : UIView<ILRenderProtocol>

- (id)initWithFrame:(CGRect)frame withRendererType:(ILEAGLRendererType)rendererType;

- (void)setRenderWithClassName:(NSString *)renderClass;

- (void)setDataSize:(int)newWidth andHeight:(int)newHeight;

- (void)enterForeground;

- (void)enterBackground;

- (void)willEnterForeground;

- (void)didEnterBackground;

- (void)setLayerScale:(float)scale;

- (void)drawVideoFrame:(ILVideoFrame*)frame;
- (void)drawVideoFrame:(ILVideoFrame*)frame finished:(void (^)())finished;
- (void)flush;

- (void)disableLensCorrent;
- (void)enableLensCorrent;

-(void)renderSplitHorizontalView:(RenderSplitMode)splitMode;

- (void)disableTimeStampCorrent;
- (void)enableTimeStampCorrent;

- (UIImage*)snapshotPicture;

- (BOOL)lensCorrentStatus;
- (BOOL)timStampCorrentStatus;

- (void)setWaterMarkOffsetX:(CGFloat)x;
- (void)setWaterMarkOffsetY:(CGFloat)y;
- (void)setCorrectionRadius:(CGFloat)radius;
@end
